$n = 1;
#$dir = "/data1/bsi/bioinf_int/s106381.borawork/data_HTHGU/MayoGAP/mayogap_emerge/clean/test_plink";
$dir = "/data1/raw/ngs/illumina-ga-1/bioinf_int/MayoGAP/mayogap_emerge/clean/test_plink";
while($n<23)
{
	open(WRBUFF,">./scripts/s$n");
	$line = "/projects/bsi/gentools/bin/plink --bfile $dir/hapmap_CEU_r23a  --chr $n --make-bed --out $dir/hapmap_CEU_r23a_chr$n\n";
	print WRBUFF $line;
	#$line = "/projects/bsi/gentools/bin/plink --bfile $dir/exc_fwdStrandResults_new_mayogap_emerge_clean  --chr $n --make-bed --out $dir/exc_fwdStrandResults_new_mayogap_emerge_clean_chr$n\n";
	#print WRBUFF $line;
	#$line  = "/projects/bsi/gentools/bin/plink --bfile $dir/hapmap_CEU_r23a_chr$n --bmerge $dir/exc_fwdStrandResults_new_mayogap_emerge_clean_chr$n.bed $dir/exc_fwdStrandResults_new_mayogap_emerge_clean_chr$n.bim $dir/exc_fwdStrandResults_new_mayogap_emerge_clean_chr$n.fam --make-bed --out $dir/merged$n\n";
	#print WRBUFF $line;
	system("qsub -l h_vmem=10G -V -cwd -q 1-day ./scripts/s$n");
	$n++;
}
